/**
 * 
 * @Project le cOeur - Data Virtualization
 * @Date 08.12.2012
 * @Author Aebi Pascal, Kocher Marc
 * @School BFH-TI Biel, Bachelor Thesis
 *
 */

package main.api.http;

/**
 * This class represents a component defined by the HTTP protocol (RFC-2616).
 */
public class MessageBody {

	private String message;
	private ContentType contentType;
	private int length;
	
	/**
	 * Creates a HTTP message body.
	 * 
	 * @param message The message string.
	 * @param contentType The content type of the message.
	 */
	public MessageBody(String message, ContentType contentType) {
		this.message = message;
		this.contentType = contentType;
		this.length = message.length();
	}
	
	@Override
	public String toString() {
		return this.message;
	}

	/**
	 * Returns the string of message.
	 * 
	 * @return The message.
	 */
	public String getMessage() {
		return this.message;
	}
	
	/**
	 * Returns the content type of the message.
	 * 
	 * @return The content type.
	 */
	public ContentType getContentType() {
		return this.contentType;
	}
	
	/**
	 * Returns the length of the message.
	 * 
	 * @return The length.
	 */
	public int getLength() {
		return this.length;
	}

}
